# -*- coding: utf-8 -*-
"""
@Time ： 2023/1/1 15:28
@Auth ： jiraWu
@File ：requests_get请求.py
@IDE ：PyCharm
@Motto:人生苦短，我学Python

"""

"""
urllib
1.1个类型(HTTPResponse)6个方法
2.get请求
3.post请求
4.Ajax的get请求
5.Ajax的post请求
6.cookie登录 微博
7.代理
"""
"""
requests
1.1个类型(Response)6个属性
2.get请求
3.post请求
4.代理
5.cookie 验证码
"""
import requests

url = "https://www.baidu.com/s"
params = {
    "wd": "北京"
}
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    ,
    "cookie": "BIDUPSID=B57B32E6C59F55EDF52BBB2A52D097F3; PSTM=1654247182; BAIDUID=B57B32E6C59F55EDABB894F9521AB43C:FG=1; BD_UPN=12314753; BDUSS=JKdS1Oam0teUxVeTRtMUFzLUlqeUhoYWNNOXA4VU9TS1NTWGllUGl2NUV4YXBqRVFBQUFBJCQAAAAAAAAAAAEAAADklEbpUVExOTA4NTQ1NDE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQ4g2NEOINjMX; BDUSS_BFESS=JKdS1Oam0teUxVeTRtMUFzLUlqeUhoYWNNOXA4VU9TS1NTWGllUGl2NUV4YXBqRVFBQUFBJCQAAAAAAAAAAAEAAADklEbpUVExOTA4NTQ1NDE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQ4g2NEOINjMX; BDSFRCVID=0_POJexroG0wKK3j4jhd-_t6-gKK0gOTDYLEOwXPsp3LGJLVgrUBEG0Pt_U-mEt-J8jwogKK3gOTH4DF_2uxOjjg8UtVJeC6EG0Ptf8g0M5; H_BDCLCKID_SF=JnAfoKK2fIt3qJTph47hqR-8MxrK2JT3KC_X3b7Ef-O_Kq7_bf--Dx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jTLhj5ObeU5eetjK2CntsJOOaCk2_UJOy4oWK441DhJiB5JBJIQ30T67bILVepvoD-Jc3M04X-o9-hvT-54e2p3FBUQJqx5tQft20b0m3ecL0R0LWJbBLb7jWhk5ep72y5OUQlRX5q79atTMfNTJ-qcH0KQpsIJM5-DWbT8IjH62btt_tRIHoCbP; BA_HECTOR=810g8k242laga18420842kv71hr2dro1i; ZFY=pjDYXp0wHTou:AJVxh5M3M5:AvFzuv46hBDqPr4Mjxdd8:C; BAIDUID_BFESS=B57B32E6C59F55EDABB894F9521AB43C:FG=1; BD_HOME=1; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; H_PS_PSSID=36551_37973_37647_37552_38013_36920_37990_37797_36802_37928_37902_26350_37285_37881; H_PS_645EC=40042hl7Sbr1/rqovQSj8f4QNnB3+T/ogSsldw356smZsJerkOhg7fLAatc; baikeVisitId=6c768246-3f76-46d9-847a-d2f89028977f; B64_BOT=1; kleck=82be2aa6738f0777282f98b129d598b2"
}
"""
1.url 请求资源路径
2.params 请求参数 无需urlencode编码
3.kwargs 字典
tips:无需请求定制
"""
resp = requests.get(url=url, params=params, headers=headers)

print(resp.url)
